package com.gitee.ixtf.vertx.verticle

import cn.hutool.log.Log
import com.gitee.ixtf.guice.Jguice
import com.gitee.ixtf.guice.Jguice.injectMembers
import io.vertx.core.Context
import io.vertx.core.Vertx
import io.vertx.core.eventbus.EventBus
import io.vertx.core.file.FileSystem
import io.vertx.ext.web.client.WebClient
import io.vertx.kotlin.coroutines.CoroutineEventBusSupport
import io.vertx.kotlin.coroutines.CoroutineRouterSupport
import io.vertx.kotlin.coroutines.CoroutineVerticle

abstract class BaseCoroutineVerticle :
    CoroutineVerticle(), CoroutineEventBusSupport, CoroutineRouterSupport {
  protected open val log: Log by lazy { Log.get(this::class.java) }
  protected val eventBus: EventBus by Jguice
  protected val fileSystem: FileSystem by Jguice
  protected val webClient: WebClient by Jguice

  override fun init(vertx: Vertx, context: Context) {
    super.init(vertx, context)
    injectMembers(this)
  }
}
